#!/usr/bin/env python2

import random
import math

n = 1
count = 100
rate = 20

for V in range(5, count):
	
	filename = "test-" + str(n) + ".txt"
	
	n = n + 1
	
	fle = open(filename, "w+")
	
	print "Generating test: " + filename + "..."
	
	nodos = V + 1
	fabricas = int(math.ceil(rate * nodos / 100))
	clientes = nodos - fabricas
	aristas = (nodos * (nodos-1)) / 2
	
	fle.write(str(fabricas) + " " + str(clientes) + " " + str(aristas) + "\n")
	
	for i in range(nodos):
		for j in range(i+1, nodos):
			fle.write(str(i+1) + " " + str(j+1) + " " + str(random.randint(0,50)) + "\n")
	
	fle.close()
